home *** CD-ROM | disk | FTP | other *** search
- Subject: lplot and quickplot (Part 1 of 2)
- From: Duane Hesser <talcott!seismo!hplsla!tikal!sysad>
- Newsgroups: mod.sources
- Approved: jpn@panda.UUCP
-
- Mod.sources: Volume 4, Issue 93
- Submitted by: Duane Hesser <seismo!hplsla!tikal!sysad>
-
- This source distribution contains source for "lplot" and "quickplot";
- filters for P300 and ascii terminals primarily for BSD sites. The
- latter makes a printable ascii approximation of a standard Unix plot
- stream on any ascii device. "Lplot" makes an output stream which will
- use the plot mode of a Printronix P300 or equivalent printer.
-
- The README describes the programs in more detail, along with a few
- portability issues. Also included are some simple "C" programs to
- generate arcs, lines, etc.; useful for testing lplot and quickplot.
- -----cut here-----------cut here-----------cut here-------
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create the files:
- # README
- # lplot.p
- # quickplot.p
- # This archive created: Fri May 2 18:20:50 1986
- export PATH; PATH=/bin:$PATH
- echo shar: extracting "'README'" '(6240 characters)'
- if test -f 'README'
- then
- echo shar: will not over-write existing file "'README'"
- else
- cat << \SHAR_EOF > 'README'
- /*
- * It is the intent of the author that this software may be
- * distributed and used freely, without restriction. If you
- * make improvements or enhancements, I would appreciate a
- * copy.
-
- * The author makes no warranty, express or implied, as to
- * the functioning or suitability of the software for any
- * purpose, and the fact of distribution implies no such
- * warranty. The author assumes no responsibility for
- * himself or others in connection with this software of any
- * use of it (i.e., you may use it freely, but don't blame
- * me if something goes wrong).
-
- * Duane H. Hesser, Teltone Corporation
- * ....uw-beaver!tikal!sysad
- * ....uw-beaver!tikal!dhh
- */
-
- "lplot" is a plot(3) filter for Printronix P300 (or
- equivalent) printers. "quickplot" is a plot(3) filter for
- any ascii terminal. "Quickplot" can be used to display
- simple low-resolution plots, but is probably more useful for
- previewing plot streams before plotting on a real plottting
- device.
-
- "lplot" accepts the arguments which the 4.2BSD printer
- spooler sends to plot filters (hostname, user, and pixel
- sizes), and thus may be used in /etc/printcap on 4.2BSD
- systems as the "g" filter for a printer. (These arguments
- are optional.) Please see the supplied manual pages for
- further information about behavior and available options.
-
- These programs have been compiled sucessfully under BSD 4.2
- on a Pyramid, and BSD 4.2 and 4.1 on Vax 750's. There
- should be little to prevent their compilation on any Unix
- system which has the plot(3) library. (ummm... you will also
- need some form of bzero() and bcopy()).
-
- CAVEATS: "quickplot" needs the termcap library; it would not
- be difficult to do without it. "lplot" requires about
- 104kbytes for the output array (no raster file is used), so
- machines with limited data space will need to restrict the
- plotting area (cut down the array size), or modify the
- point() and output() routines to use some sort of virtual
- array with disk buffering. BEWARE your line printer driver.
- Some drivers like to do a bit of processing on the data sent
- to them, assuming that you want backspaces and carriage
- returns handled specially, for example. The driver must
- pass lplot output untainted by its own pre-conceptions.
-
- "lplot" assumes that the paper in the printer is positioned
- at line 1, rather than at the fold, so that printing (or
- plotting) begins at the first line on the page. This means
- that it assumes 780 dots vertically, rather than 792. If
- this doesn't suit your situation (and you find top-of-form
- creeping), change YDOTS in "defs.h". Horizontal dot density
- is 60 dots per inch, vertical dot density is 72 dots per
- inch, and array space is provided to permit plotting on a
- full page of 132 column by 11 inch printer paper. Although
- the space() routine maps its arguments into an 8 inch
- plotting area in the lower left corner of the page, plotting
- is permitted outside that range. (Note: "quickplot"
- truncates data outside the mapped area, which is taken to be
- the full terminal screen.)
-
- MAKEFILES:
- There are 3 makefiles: one for "lplot" one for "quickplot"
- and one to control the other two. The latter is "Makefile".
- If you type "make" by itself, the following list of targets
- will be printed:
-
- Use:
- make all to update lplot and quickplot
- make new to make both from scratch
- make clean to remove .o files
- make bclean to remove binaries and .o files
- make lplot to make only lplot
- make quickplot to make only quickplot
- make install to update and install both
- make install_l to update and install lplot
- make install_q to update and install quickplot
-
- You should edit "Makefile" to set BIN (the directory where
- the binaries are to be installed), and MAN (where the manual
- pages are to be copied). As delivered, BIN=/usr/public/bin,
- MAN=/usr/man/manp.
-
- You should also check the DEFINES. Then type "make new" to
- make both binaries (or "make install" if your want to do the
- whole thing in one swell foop). The DEFINES should be
- changed in Makefile.lplot and Makefile.quickplot as
- appropriate. "make install" will install the binaries, and
- make a link to "lplot" called "rlplot". "rlplot" activates
- the 'rotate' option, which causes the plot to be rotated 90
- degress ccw. We use this in /etc/printcap for one of our
- printers in which we use 8 1/2 x 11 paper, with appropriate
- pixel sizes, to cause the long dimension of the paper to
- appear "horizontal" to the plot. If you don't have the 4.2
- spooler, don't use narrow paper, or just plain don't need
- rotated plots, you may wish to delete this from the
- makefile.
-
- Note: the rather strange makefile setup is intended to keep
- track of which binary is being created. Loading "lplot"
- with object files created with QUICKPLOT defined is
- ineffective. Use separate directories if you prefer.
-
- DEFINES:
- define BIGENDIAN if you are compiling for a machine with
- mad-hatter byte-order (3,2,1,0,7,6,5,4...) like Pyramids and
- 68000's. Leave it out for Vaxes.
-
- define DEBUG to compile in some debugging code. This is set
- in the delivered makefiles, and compiles in a '-d' flag
- which permits 3 levels of debugging output (controlled by
- the 1,2,4 bits in the single- digit following argument).
- '-d 1' outputs the decoded and scaled plot stream commands,
- and can be useful for debugging plot streams; the remaining
- bits are useful only for program debug.
-
- define QUICKPLOT to compile "quickplot"; leave it out to
- compile "lplot". These are set up already in the
- appropriate makefiles.
-
- All other defines are in "defs.h", and should not need to be
- changed unless you have a printer with different dot density
- or perhaps a different graphics code, etc.
-
- ONE LAST THING
- The sources in this distribution are created with 4 space
- tabstops. They contain comment-commands for later versions
- of "vi" to set tabstops appropriately; if this doesn't work
- for you, set tabstops manually to 4, use "expand -4", or run
- them thru a sed script or "indent".
- SHAR_EOF
- if test 6240 -ne "`wc -c < 'README'`"
- then
- echo shar: error transmitting "'README'" '(should have been 6240 characters)'
- fi
- fi
- echo shar: extracting "'lplot.p'" '(4313 characters)'
- if test -f 'lplot.p'
- then
- echo shar: will not over-write existing file "'lplot.p'"
- else
- cat << \SHAR_EOF > 'lplot.p'
- .TH LPLOT PUBLIC
- .UC 4
- .SH NAME
- lplot \- plot filter for Printronix P300 style line printers
- .SH SYNOPSIS
- .B lplot
- [ option ] ...
- [ file ]
- [ option ] ...
- [ file ] ...
- .SH DESCRIPTION
- .I Lplot
- accepts a plot stream as produced by the plot(3) functions and
- generates on the standard output a byte stream which will produce
- the plot on a Printronix P300 style line printer using the printer's
- "graphics" mode.
- No raster file is generated; plot data is sent directly to standard output.
- .PP
- By default, plots are scaled to an 8 inch square plotting area,
- to be consistent in scale with other plot filters.
- Arguments are provided to change scaling in one or both directions,
- change the area into which the space() (see plot(3)) call maps
- user data, change the position of the plot on the page, or rotate
- the plot 90 degrees counter clockwise (useful primarily for printers
- loaded with 8 1/2 x 11 inch paper).
- .PP
- .I Lplot
- will accept the arguments passed by the Berkeley 4.2BSD printer
- spooler for accounting; thus it may be used in /etc/printcap as
- the "g" filter on such systems. No accounting is performed, of
- course, if these arguments are not given Arguments for pixel width and
- height are also recognized and used (within compiled-in limits).
- .PP
- If called as
- .I rlplot,
- the plot will be rotated 90 degrees counter-clockwise (-r flag) and the
- origin will be located at the lower right of the page.
- .PP
- If no file arguments are given,
- .I lplot
- reads from the standard input.
- If file arguments are given, an argument consisting of the single
- character '-' will be replaced by the standard input.
- .PP
- The P300 printer has a resolution of 60 dots per inch horizontally,
- 72 dots per inch vertically.
- The default 8 inch plot area is thus 480 dots x 576 dots.
- The maximum plot area is 780 dots x 792 dots (12 dots are unavailable
- when the print head is positioned at the first printable line).
- .SH OPTIONS
- .IP "-H \fIx\fP" 15n
- limit the plot to \fIx\fP dots horizontally (maximum 792).
- .IP "-W \fIy\fP" 15n
- limit the plot to \fIy\fP dots vertically (maximum 780).
- .IP "-s[xy] \fIfactor\fP" 15n
- set an overall scale factor. The plot is magnified by the scale factor
- (but may be truncated if the resulting plot area is larger than the
- page). If \fIx\fP or
- \fIy\fP is given, the scale factor will be applied in the indicated
- direction only.
- .IP "-X \fInum\fP" 15n
- move the plot right \fInum\fP inches (negative \fInum\fP moves left).
- .IP "-Y \fInum\fP" 15n
- move the plot up \fInum\fP inches (negative \fInum\fP moves down).
- \fIchar\fP
- .IP "-e" 15n
- force an erase command between plot files
- .IP "-N" 15n
- suppress erase commands
- .IP "-r" 15n
- rotate the plot 90 degrees counter-clockwise
- .IP "-d num" 15n
- set debugging level to
- .I num
- (debugging is conditionally compiled; this may have no effect).
- The most useful setting is '1', which causes
- .I quickplot
- to print the plot(3) commands as it interprets them, with
- arguments scaled to final values.
- The plot is still generated.
- .IP "-x\fInum\fP" 15n
- limit the plot to \fInum\fP dots horizontally (maximum 792).
- Included for compatibility with the 4.2BSD line printer spooler.
- .IP "-y\fInum\fP" 15n
- limit the plot to \fInum\fP dots vertically (maximum 780).
- Included for compatibility with the 4.2BSD line printer spooler.
- .SH NOTE BENE
- .PP
- It is permissible to plot outside the 8 inch square, but
- data outside the page will be truncated (plotted at the maximum
- plot point).
- .SH DIAGNOSTICS
- \'Bad input data: cmd %o' if an unrecognized plot command is received.
- May happen if labels contain newlines, or plot stream files
- are corrupted. Scanning will continue.
- Premature EOF while reading data for a command will generate an
- appropriate error and the program will quit.
- .SH "SEE ALSO"
- quickplot(1)
- .SH AUTHOR
- Duane Hesser (sysad@teltone)
- .SH BUGS
- Labels are plotted by internal table on an 8 dot wide x 9 dot
- high grid (including 2 descenders). The resulting labels will
- generally scale somewhat larger than labels generated by other
- plot filters.
- Fonts are not available.
- .PP
- Resolution is poor.
- .PP
- .I Lplot
- attempts to send minimum data to the printer,
- by sending bytes only up to the last byte in each row containing
- data; this accomplishes little, however, if the plot is boxed.
- (Plotting is slow.)
- .PP
- There is no way to rotate characters for vertical labeling.
- SHAR_EOF
- if test 4313 -ne "`wc -c < 'lplot.p'`"
- then
- echo shar: error transmitting "'lplot.p'" '(should have been 4313 characters)'
- fi
- fi
- echo shar: extracting "'quickplot.p'" '(3842 characters)'
- if test -f 'quickplot.p'
- then
- echo shar: will not over-write existing file "'quickplot.p'"
- else
- cat << \SHAR_EOF > 'quickplot.p'
- .TH QUICKPLOT PUBLIC
- .UC 4
- .SH NAME
- quickplot \- make a printable ascii approximation of a plot stream
- .SH SYNOPSIS
- .B quickplot
- [ option ] ...
- [ file ]
- [ option ] ...
- [ file ] ...
- .SH DESCRIPTION
- .I Quickplot
- accepts a plot stream as produced by the plot(3) functions and
- generates on the standard output a byte stream which is a printable
- ascii approximation of the plot, suitable for viewing on an ascii
- terminal or printing device. Quickplot is useful for previewing
- plots on your terminal before sending to a plotting device.
- .PP
- .I Quickplot
- consults the termcap database for your terminal type (as given by
- the TERM environment variable) and attempts to size the plot to
- fill your screen. The terminal type may be overridden by specifying
- a terminal type on the command line or by specifying the rows and
- columns desired (see OPTIONS below).
- .PP
- If no file arguments are given,
- .I quickplot
- reads from the standard input.
- If file arguments are given, an argument consisting of the single
- character '-' will be replaced by the standard input.
-
- .SH OPTIONS
- .IP "-T \fIterm\fP" 15n
- make a plot suitable for terminal given by \fIterm\fP.
- .IP "-H \fIrows\fP" 15n
- map the plot into \fIrows\fP rows, instead of the rows given by termcap.
- .IP "-W \fIcols\fP" 15n
- map the plot into \fIcols\fP cols, instead of the cols given by termcap.
- .IP "-s[xy] \fIfactor\fP" 15n
- set an overall scale factor. The plot is magnified by the scale factor
- (but may be truncated if the screen is too small). If \fIx\fP or
- \fIy\fP is given, the scale factor will be applied in the indicated
- direction only.
- .IP "-X \fIcols\fP" 15n
- move the plot right \fIcols\fP cols (negative \fIcols\fP moves left).
- .IP "-Y \fIrows\fP" 15n
- move the plot up \fIrows\fP rows (negative \fIrows\fP moves down).
- .IP "-c \fIchar\fP" 15n
- The plotting character (default upper case 'X') will be replaced by
- \fIchar\fP
- .IP "-e" 15n
- force an erase command between plot files
- .IP "-N" 15n
- suppress erase commands
- .IP "-r" 15n
- rotate the plot 90 degrees counter-clockwise
- .IP "-d num" 15n
- set debugging level to
- .I num
- (debugging is conditionally compiled; this may have no effect).
- The most useful setting is '1', which causes
- .I quickplot
- to print the plot(3) commands as it interprets them, with
- arguments scaled to final values.
- The plot is still generated.
- .SH NOTE BENE
- .I Quickplot
- is unlike most plot filters in that it does not map your
- plot space specifically into a square plotting area; instead, it
- attempts to obtain maximum resolution by mapping the plot into the
- full screen.
- Since most terminals have many more columns than rows, most plots
- will be "distorted" (a square box will plot as a rectangle).
- .PP
- Data outside the plot area will be truncated (plotted at the maximum
- plot point) and the normal plot character will be replaced by the
- character '@' (which does not change if you select '@' as the plot
- character).
- .PP
- IF MORE THAN ONE PLOT FILE IS GIVEN AS ARGUMENT,
- .I quickplot
- will pause
- .B SILENTLY
- between plots (unless standard output and standard error have been
- re-directed) and wait for a single carriage return before proceeding
- to the next plot.
- .SH DIAGNOSTICS
- \'Bad input data: cmd %o' if an unrecognized plot command is received.
- May happen if labels contain newlines, or plot stream files
- are corrupted. Scanning will continue.
- Premature EOF while reading data for a command will generate an
- appropriate error and the program will quit.
- .SH "SEE ALSO"
- lplot(1)
- .SH AUTHOR
- Duane Hesser (sysad@teltone)
- .SH BUGS
- Resolution is understandably poor.
- Plots are squashed vertically.
- .PP
- .I Quickplot
- attempts to identify dotted, dashed, etc. lines by plotting alternate
- characters in a line as a small integer digit representing the line
- type. For short line segments, this doesn't work very well, since there
- is no memory of the previous line segment.
- SHAR_EOF
- if test 3842 -ne "`wc -c < 'quickplot.p'`"
- then
- echo shar: error transmitting "'quickplot.p'" '(should have been 3842 characters)'
- fi
- fi
- exit 0
- # End of shell archive
-